from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtNetwork import *
import sys
import sqlite3

from interface import mainwindow,newhost

hosts = []

class Host():
    address = None,
    port = None


def loadhosts():
    conn = sqlite3.connect('configdb')
    c = conn.cursor()
    result = c.execute(" SELECT * FROM hosts ")
    for host in result:
        print(host[0])

class MainWindow(QMainWindow, mainwindow.Ui_MainWindow):

    def newHostOpen(sender):
        newHostWindow = NewHostWindow(sender)

    def __init__(self, parent = None    ):
        QMainWindow.__init__(self, parent)
        self.setupUi(self)
        QObject.connect(self.newHost,SIGNAL("clicked()"), self.newHostOpen)

class NewHostWindow(QMainWindow, newhost.Ui_NewHost):

    def saveHost(sender):
        print('auihaiuaha')

    def __init__(self, parent = None):
        QMainWindow.__init__(self, parent)
        self.setupUi(self)
        QObject.connect(self.buttonBox,SIGNAL("clicked()"), self.saveHost)
        self.show()


app = QApplication(sys.argv)



mainwindow = MainWindow()

mainwindow.show()

app.exec_()
